#!/usr/bin/env python
#-*-coding:utf-8-*-
#在qe中有时候需要将一些日期转换为周
from datetime import timedelta, datetime
day_format_short="%Y%m%d"
#设定起始时间
t_start=datetime.strptime("20130516",day_format_short)
#循环输出repeat_times周
repeat_times = 13
for i in range(1,repeat_times+1):
    t_week_start = t_start + timedelta(days=(i-1)*7)
    t_week_end = t_start + timedelta(days=(i-1)*7+6)
    print "when event_day >= \""+t_week_start.strftime(day_format_short)+"\" and event_day <= \""+t_week_end.strftime(day_format_short)+"\" then ",i